 @extends('layouts.art')
@section('content')

<form class="form-horizontal" action="photo" method="post" enctype="multipart/form-data"  id="avatar">
		   {{ csrf_field() }}
  <div class="form-group">
    <label for="inputEmail3" class="col-sm-2 control-label">名字</label>
    <div class="col-sm-8">
      <input type="title" class="form-control" id="title" name="title">
    </div>
  </div>


  <div class="form-group">
    <label for="inputEmail3" class="col-sm-2 control-label">头像</label>
    <div class="col-sm-8">
        <input type="file" class="form-control" id="title" name="photo">
    </div>
  </div>
   
  
  <div class="form-group">
    <div class="col-sm-offset-2 col-sm-10">
      <button class="btn btn-default" onclick="uploadInfo()">上传</button>
    </div>
  </div>
</form>

<script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
<script type="text/javascript">
function uploadInfo() {  
     var formData = new FormData($("#avatar"));  
     $.ajax({  
          url: "{{url('photo')}}",
          type: 'POST',  
          data: formData,  
          contentType: false,  
          processData: false,  
          success: function (returndata) {  
              console.log(returndata);  
          },  
          error: function (returndata) {  
              console.log(returndata);  
          }  
     });  
}  

</script>

@endsection